package com.example.demo.login.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import com.example.demo.login.dao.userMapper;
import com.example.demo.login.pojo.user;
import com.example.demo.login.service.UserService;

/**
 * 
 * <p>
 * 功能描述：用户service 实现类
 * </p>
 * 
 * @author lixh
 * @date 2019年1月30日 下午3:56:30
 * @version 1.0
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {
	@Autowired
	userMapper userMapper;

	@Override
	public List<Map<String, Object>> getUserList(Map<String, Object> map) {
		return null;
	}

	@Override
	public user getUser(String id) {
		return null;
	}

	@Override
	public List<user> getUser(user user) {
		return null;
	}

	@Override
	public Integer delete(String id) {
		if (StringUtils.isEmpty(id)) {
			return null;
		}
		return userMapper.deleteByPrimaryKey(Integer.valueOf(id));
	}

	@Override
	public Integer add(user user) {
		if (StringUtils.isEmpty(user)) {
			return null;
		}
		return userMapper.insertSelective(user);
	}

	@Override
	public Integer update(user user) {
		if (StringUtils.isEmpty(user)) {
			return null;
		}
		return userMapper.updateByPrimaryKeySelective(user);
	}

	@Override
	public user getUserName(String name) {
		if (StringUtils.isEmpty(name)) {
			return null;
		}
		user user = new user();
		user.setUsername(name);
		return userMapper.selectByUser(user);
	}

}
